﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GCPUD.Autoprov.Network
{
    public class Port : IComparable, IEquatable<Port>
    {
        private List<Vlan> portVlanList;
        private bool isTagged;
        private string portSpeed;
        private string portNum;
        private string portSlot;
        public string ifIndex { get; set; }
        public string ifDesc { get; set; }
        public string ifType { get; set; }
        public int nodeid { get; set; }
        public bool isPOTS { get; set; }
        public bool isVideo { get; set; }
        public int priority { get; set; }
        public string ifName { get; set; }
        public string IfOperStatus { get; set; }


        public string PortNum
        {
            get { return portNum; }
            set { portNum = value; }
        }
        public string PortSpeed
        {
            get { return portSpeed; }
            set { portSpeed = value; }
        }
        public bool IsTagged
        {
            get { return isTagged; }
            set { isTagged = value; }
        }
        public string PortSlot
        {
            get { return portSlot; }
            set { portSlot = value; }
        }
        public List<Vlan> PortVlanList
        {
            get { return portVlanList; }
            set { portVlanList = value; }
        }
        public int CompareTo(Object obj)
        {
            Port port = obj as Port;
            if (port == null) return 1;
            if (port != null)
                return int.Parse(this.ifIndex).CompareTo(int.Parse(port.ifIndex));
            else
                throw new ArgumentException("Object is not a Port");
        }
        public override int GetHashCode()
        {
            return this.ifIndex.GetHashCode();
        }
        public override bool Equals(Object obj)
        {
            Port port = obj as Port;

            if (port != null) return Equals(port);
            else return false;

        }
        public bool Equals(Port p)
        {
            if ((object)p.ifIndex == null)
            {
                return false;
            }
            return this.ifIndex.Equals(p.ifIndex);
        }

    }
}
